home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
c
/
optans10.zip
/
OPTANSI.DOC
< prev
next >
Wrap
Text File
|
1992-06-14
|
60KB
|
1,295 lines
*******************************************************************************
OptANSI Library
version 1.0
Copyright 1992 Michael Dannov
Optimizing ANSI Output Library for Borland C
*******************************************************************************
DOCUMENTATION
------------------------------------------------------------------------------
*ABOUT OPTANSI*
What is the OptANSI Library?
OptANSI was designed to output fully optimized and compressed ANSI codes
on the fly to any ANSI interpreting device. It is NOT an interpreter by any
means, so it does not receive incoming ANSI and convert it into logical screen
output. Usually this control is left to the ANSI device or the comm program.
Who can use the OptANSI Library?
Anyone who programs in Borland C and has need to use the ANSI screen
interface can use OptANSI. It is well suited for most communication appli-
cations like BBS programs, remote doorways, fossil drivers, telecommunication
programs, and BBS doors. It can also be used with ANSI drawing packages and
other ANSI utilities. In fact, it has been used to design the popular AOPT
(ANSI Optimizer) utility which takes standard .ANS files and reduces them to
their minimum size without affecting resulting output. You may also find other
uses for OptANSI if you simply want an alternative method for screen output
aside from VIDEO BIOS, direct screen, or DOS calls. All OptANSI functions can
be piped through DOS if you use standard printf() and other DOS forwarding
calls, thereby allowing you to send screen locations and color codes to the
screen or to a file. This is especially useful if standard conio is not always
appropriate or compatible; for instance, DOS shells using telecommunications
without a gateway.
Why use the OptANSI Library, say as opposed to another?
There are a number of generic ANSI libraries out there to use. I might
have used them myself if I hadn't grown so critical of all the wasted time
sending unnecessary codes. ANSI is a slow interface by design and there is
little sense wasting good process time on unneeded output. For instance, say
you are using your 2400 baud modem online with a BBS who's sysop loves
switching between those ANSI colors. It takes a lot of time to draw the screen
at that speed and any sort of optimization at all could be beneficial. OptANSI
will practically never result in slower output even if your application uses
14400 baud transfers. OptANSI should not impede output times; it can only
benefit them.
OptANSI functions will produce output that is 10-30% smaller of all
output sent (ie, ANSI and all other text) compared with other libraries. Of
pure ANSI output, OptANSI produces 20-60% smaller output. Both these figures
are dependant on how intensive your the of ANSI.
Another important feature is that OptANSI has ten times the number of
functions as other libraries. It's true, many of these are macros that call
coded functions, but the underlying code and data (if ALL functions in the
library are used) occupies less than 1.5K of memory.
How can I use OptANSI Library?
First, link the OptANSI LIBrary file to your project. Second, all OptANSI
functions are very similar to conio functions, so it shouldn't be to much of
a strain to learn and use. The function names use a one letter suffix "a" for
ANSI. An example is gotoxy(x, y) which in OptANSI is agotoxy(x, y, &x, &y).
OptANSI functions are very tight. Much of the code is written in assembly
using optimized BC asm inlines. Also, the library is spread out so that only
functions called by your program are actually linked into the executable.
How does OptANSI work?
OptANSI, unlike rival libraries, remembers critical information about its
former states, like last cursor position and previous color. OptANSI takes
advantage of all the ASCII and ANSI rules to take advantage of all possible
shortcuts and will 99.9% of the time find the shortest output path.
There seem to be a number of ANSI standards; by which one does OptANSI comply?
OptANSI is mostly composed of a combination of the shared rules of many
different ANSI devices or at least their expected operations. There have been
bugs in various ANSI drivers released over the last 10 years. ANSI.SYS which
accompanies DOS is no exception. OptANSI has been tested with most public ANSI
drivers and certain flags have been implemented to allow the programmer or the
user (if designed to do so) to decide which outputs are valid to optimize.
OptANSI also includes a number of functions that the programmer can
decide whether or not to implement. Some of the NANSI (New ANSI) and other
ANSI extensions have been included like insert line, delete line, insert
spaces, delete spaces, etc.
Performance Results from ALL output sent:
Raw OptANSI Other libraries FNs
WWIV BBS Capture (*): 69180 56241 - 19% 70683 + 2% 1
PCBoard Capture (*): 41335 39374 - 5% 47763 + 15% 1
Wildcat (*): 26639 19665 - 26% 27213 + 2% 1,2
Doorway, Rmt DOS Capture: 51308 42610 - 17% 55389 + 8% 2,1
TheDraw ANSI: 24271 23521 - 3% 28253 + 16% 2,1
Raw - Raw Output
OptANSI - Raw Output retransmit through OptANSI
Other Libraries - Raw Output retransmit through other libraries
FNs - Primary ANSI functions were (in order of probability):
1 - Color Functions
2 - Location Functions
3 - Miscellaneous Functions
(*) Results from BBS Systems are based on ANSI captures during a regular
session with ANSI on. This includes newscanning files (FN 1), reading a
message (FN1), writing a single reply with a full screen editor if available
(FN 1,2), etc.
PCBoard's ANSI is pretty well optimized.
NOTE: The values above are probably not reflective of performance for your
applications since many of the above programs have already been optimized,
which goes to prove that it is probably a good idea.
------------------------------------------------------------------------------
*REGISTERING OPTANSI*
As a registered owner of the OptANSI library, you will get complete
source code to the library. You can modify the source code to fit your needs
if necessary, but you can never give out the OptANSI based source code even if
it is modified beyond recognition. You also may not use the OptANSI library to
make a competing library. Ergo, you cannot use OptANSI to make an optimizing
ansi library that you distribute or sell to others, not even for other
platforms [unless you get written permission from the author]. Also, there
exists a copyright notice in the data of ainit. This does not need to be
displayed anywhere in your programs, but must remain in the final executable.
Do not remove this code from ainit.c. Other restrictions apply based on which
license you pay. See below.
No Royalties Apply to OptANSI library licenses. However, different
licenses have different prices. Please read the information about each license
option below to ensure that one you select is the one that satisfies your
qualifications. Limitations apply to each. If you have questions or require
special considerations, please contact the author listed below.
-LICENSE OPTION------------------------------------ -REG PRICE-
Private license $15
Shareware license $30
Small commercial license $50
Full commercial license $500
Printed documentation ADD $10
All Future Upgrades $5
Private License: OptANSI library can only be included in software written
which is NOT FOR SALE. Ie, it is part of your cost for doing business. One
license applies to one person or one business dependi